package yt.demo.appcoresystem.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import yt.demo.appcommondb.base.BaseEntity;

import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@Schema(name = "SystemMenu", description = "系统菜单")
public class SystemMenu  extends BaseEntity<SystemMenu> {

    @TableId
    @Schema(name = "id", description = "主键ID")
    @NotNull(groups = UpdateGroup.class,message = "id不能为空") // 更新时确保此字段不能为空
    private Long id;

    @Schema(description="父ID")
    private Long parentId;

    @Schema(description="菜单名称")
    private String name;

    @Schema(description="菜单图标")
    private String icon;

    @Schema(description="菜单标识代码")
    private String code;

    @Schema(description="菜单类型, (M菜单 B按钮 L链接 I iframe)")
    private Long menuType;

    @Schema(description="组件路径")
    private String component;

    @Schema(description="路由路径")
    private String route;

    @Schema(description="排序")
    private Integer sort;

    @JsonProperty("is_hidden")
    @Schema(description="是否隐藏 1是 2否")
    private Integer isHidden;

    @TableField(exist = false)
    private List<SystemMenu> children;

}
